﻿/**
 * Proyecto: Cognitum
 * Global IT Services 2008
 * @author
 */
Cognitum.Polizas.Auto.Pool.Editor = Ext.extend(Cognitum.Polizas.General.Editor, {

    esFlotilla: true,
    
    initComponent: function(){
        Ext.apply(this, {
            seccionesAdicionales: [{
                title: 'Incisos',
                items: [{
                    xtype: 'ag.list',
                    hideLabel: true,
                    entityName: 'Autos',
                    name: 'Movimientos',
                    context: 'm.Poliza.Id =? and m.Estatus=1',
                    anchor: '99% 99%',
                    updateControls: function(value) {
                        if (Ext.isEmpty(value)) {
                            return;
                        }
                        // menu config
                        this.canUpdate = this.canUpdate && value.EstatusPoliza == 0;
                        this.deleteMenuAction.setDisabled(!(this.canDelete && value.EstatusPoliza == 0));
                        this.newMenuAction.setDisabled(!(this.canNew && value.EstatusPoliza == 0));
                        this.newToolbarButton.setDisabled(!(this.canNew && value.EstatusPoliza == 0));
                    },
                    listeners: {
                        refresh: {
                            fn: function() {
                                this.entityId = this.value.Id;
                                this.loadAction();
                            },
                            scope: this
                        }
                    }
                }]
            }]
        });
        Cognitum.Polizas.Auto.Pool.Editor.superclass.initComponent.apply(this, arguments);
    }
    
});

Ext.reg('pol.auto.pool.editor', Cognitum.Polizas.Auto.Pool.Editor);
